/*
 * cardtest4.c
 *
 *  Created on: Jan 26, 2014
 *      Author: Charles_OSU
 */

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "rngs.h"
#include <math.h>

#define DEBUG 0


// prototypes
int testgardens(int currentPlayer, int card, struct gameState *state);

int testgardens(int currentPlayer, int card, struct gameState *state){

    int handPos = floor(Random() * state->handCount[currentPlayer]);
    int bonus[2] = {0, 1};
    int r = cardEffect(card, 1, 1, 1, state, handPos, bonus);

    assert (r == -1);
   return 0;

}




/*
 * Using a common template to call and setup tests for each card since we must
 * call all cards as if they are in the Cardeffect or their own function which
 * simply means that we should call them from Cardeffect. I have started to run out
 * of time so I have resorted to the slopy way of just doing asserts instead of the
 * more proper way i did them in unittest1..unittest3
 */
int main() {
	// Declare variable to use
	  int n;
	  int i;
	  int p;
	  int testNums = 0;
	  struct gameState gameStateTest;

	  // Print a headder
         printf ("Testing cardEffect() with gardends card\n");
         printf ("RANDOM TESTS\n");

         // Seed our game
         SelectStream(2);
         PutSeed(3);


             for (n = 0; n < 2000; n++) {
               for (i = 0; i < sizeof(struct gameState); i++) {
                    ((char*)&gameStateTest)[i] = floor(Random() * 256);

                 }

               p = floor(Random() * MAX_PLAYERS);
                 gameStateTest.whoseTurn = floor(Random() *MAX_PLAYERS);
                 p = gameStateTest.whoseTurn;
                 gameStateTest.deckCount[p] = floor(Random() * MAX_DECK);
                 gameStateTest.discardCount[p] = floor(Random() * MAX_DECK);
                 gameStateTest.handCount[p] = floor(Random() * MAX_HAND);
                 gameStateTest.playedCardCount = floor(Random() * MAX_DECK);



                 testgardens(p, gardens, &gameStateTest);


               testNums += 1;
        }

       // If we get to here it means we kept running and did not crash the program
        // so our tests must have run now let's see how many errors we got.
          printf ("All Tests ran for testgardens\n");
          printf ("%d RANDOM TESTS.\n", testNums);


        return 0;

}

